package ru.paswd.marketprice.rest.app.repositories;

import org.springframework.data.repository.CrudRepository;
import ru.paswd.marketprice.rest.app.entity.Price;
import ru.paswd.marketprice.rest.app.entity.Product;
import ru.paswd.marketprice.rest.app.entity.Shop;

import java.util.List;
import java.util.Optional;
import java.util.UUID;

public interface PricesRepository extends CrudRepository<Price, UUID> {

    Optional<Price> findByShopAndProduct(Shop shop, Product product);

    List<Price> findAllByProduct(Product product);

    Optional<Price> findFirstByProductOrderByPriceAsc(Product product);

    Optional<Price> findFirstByProductOrderByPriceDesc(Product product);
}
